package cn.oa.dao;

import cn.oa.service.AttendanceService;
import org.omg.CORBA.portable.ApplicationException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.SimpleTimeZone;

import static org.junit.Assert.*;

public class AttendanceMapperTest {


    @org.junit.Test
    public void deleteAttendanceByEmployeeId() {
    }

    @org.junit.Test
    public void getRecordByEmployeeIdAndDate() throws ParseException, SQLException {
        String str = "2020-2-22";
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date parse = simpleDateFormat.parse(str);
        String format = simpleDateFormat.format(parse);
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-dao.xml");

        AttendanceService service = context.getBean("attendanceService",AttendanceService.class);
        System.out.println(service.addSignInByEmployeeId(5,format));
    }

    @org.junit.Test
    public void addSinginByEmployeeId() {
    }

    @org.junit.Test
    public void updateSingoutByAttendanceId() {
    }

    @org.junit.Test
    public void getAttendancesByPage() {

;

        ApplicationContext context = new ClassPathXmlApplicationContext("spring-dao.xml");

        AttendanceService service = context.getBean("sqlSessionFactory",AttendanceService.class);
//        System.out.println(service.getAttendancesByPage("黄鹏","153486");
    }

    @org.junit.Test
    public void getAttendancesCount() {
    }
}